// run: $exec < input
/*************************************************************************
  > File Name: 1007.cpp
  > Author: skt
  > Mail: sktsxy@gmail.com
  > Created Time: 2015年08月18日 星期二 15时18分14秒
 ************************************************************************/

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <complex>
#include <cassert>
// #pragma comment(linker,"/STACK:102400000,102400000")
using namespace std;
#define LL long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define MAXN 105
template <typename T> inline void checkMax(T &a, T b) {a = a>b?a:b;}
template <typename T> inline void checkMin(T &a, T b) {a = a<b?a:b;}
typedef pair<int, int> PII;
typedef vector<int> vi;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int INF = 0x3fffffff;
int N, M, a[MAXN][MAXN];

typedef pair<int, int> Point;

void fun1(int lx) {
	for (int i = 1; i <= lx; i ++) {
		if (i & 1) {
			for (int j = 1; j < M; j ++) {
				printf("R");
			}
			printf("D");
		} else {
			for (int j = 1; j < M; j ++) {
				printf("L");
			}
			printf("D");
		}
	}
}

void fun2(int lx) {
	for (int i = lx; i <= N; i ++) {
		if (i & 1) {
			for (int j = 1; j < M; j ++) {
				printf("L");
			}
			printf("D");
		} else {
			for (int j = 1; j < M; j ++) {
				printf("R");
			}
			if (i != N) {
				printf("D");
			}
		}
	}
}

void work() {
	int sum = 0, minvalue = INF;
	for (int i = 1; i <= N; i ++) {
		for (int j = 1; j <= M; j ++) {
			scanf("%d", &a[i][j]);
			sum += a[i][j];
			if ((i == 1 && j == 1) || (i == N && j == M)) continue;
			minvalue = min(minvalue, a[i][j]);
		}
	}
	if (N & 1) {
		printf("%d\n", sum);
		for (int i = 1; i <= N; i ++) {
			if (i & 1) {
				for (int j = 1; j < M; j ++) {
					printf("R");
				}
				if (i != N) {
					printf("D");
				}
			} else {
				for (int j = 1; j < M; j ++) {
					printf("L");
				}
				printf("D");
			}
		}
		printf("\n");
		return ;
	}
	if (M & 1) {
		printf("%d\n", sum);
		for (int i = 1; i <= M; i ++) {
			if (i & 1) {
				for (int j = 1; j < N; j ++) {
					printf("D");
				}
				if (i != M) {
					printf("R");
				}
			} else {
				for (int j = 1; j < N; j ++) {
					printf("U");
				}
				printf("R");
			}
		}
		printf("\n");
		return ;
	}
	Point oo(0, 0), oe(0, 0), eo(0, 0), ee(0, 0);
	for (int i = 1; i <= N; i ++) {
		for (int j = 1; j <= M; j ++) {
			if (i == 1 && j == 1) continue;
			if (i == N && j == M) continue;
			if (a[i][j] == minvalue) {
				if ((i & 1) && (j & 1)) oo = mp(i, j);
				if ((i & 1) && !(j & 1)) oe = mp(i, j);
				if (!(i & 1) && (j & 1)) eo = mp(i, j);
				if (!(i & 1) && !(j & 1)) ee = mp(i, j);
			}
		}
	}
	if (eo != mp(0, 0)) {
		printf("%d\n", sum - minvalue);
		fun1(eo.x - 2);
		for (int i = 1; i <= eo.y - 1; i += 2) {
			printf("DRUR");
		}
		printf("RD");
		for (int i = eo.y + 2; i <= M; i += 2) {
			printf("RURD");
		}
		if (eo.x + 1 <= N) {
			printf("D");
		}
		fun2(eo.x + 1);
		printf("\n");
		return ;
	}
	if (oe != mp(0, 0)) {
		printf("%d\n", sum - minvalue);
		fun1(oe.x - 1);
		for (int i = 1; i <= oe.y - 2; i += 2) {
			printf("DRUR");
		}
		printf("DR");
		for (int i = oe.y + 1; i <= M; i += 2) {
			printf("RURD");
		}
		if (oe.x + 2 <= N) {
			printf("D");
		}
		fun2(oe.x + 2);
		printf("\n");
		return ;
	}
}
int main() {
#ifdef __SKT__
	freopen("in", "r", stdin);
#endif
	while (scanf("%d %d", &N, &M) != EOF) {
		work();
	}
	return 0;
}
